fix(profiling): Fix app start transaction profile timestamp offset#5962
Open
fix(profiling): Fix app start transaction profile timestamp offset#5962
Conversation
Use the actual profiling start timestamp for the profile's timestamp field instead of the adjusted transaction start_timestamp. For app start transactions, the transaction start is adjusted backward to the app start time, but the profile samples are relative to when profiling actually started (JS VM start). This caused a misalignment in the Sentry UI. Fixes #4511 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
antonis
commented
Apr 7, 2026
Add unit tests for enrichCombinedProfileWithEventContext and enrichAndroidProfileWithEventContext verifying that: - profilingStartTimestampNs is used for the profile timestamp when set - Falls back to event.start_timestamp when not set - profilingStartTimestampNs is stripped from serialized output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sentry Build Distribution
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Uses the actual profiling start timestamp for the profile's
timestampfield instead of the adjustedevent.start_timestamp.For app start transactions, the SDK adjusts the transaction's
start_timestampbackward to the app start time. However, profile samples useelapsed_since_start_nsrelative to when profiling actually started (JS VM start), not the app start time. This mismatch caused the profile to appear misaligned in the Sentry UI.Changes:
profilingStartTimestampNsfield toHermesProfileEventandAndroidCombinedProfileEventtypesstopProfilingnow stores the profiling start timestamp on the returned profile eventenrichCombinedProfileWithEventContextandenrichAndroidProfileWithEventContextprefer the stored profiling start timestamp overevent.start_timestamp💡 Motivation and Context
Fixes #4511
When an app start transaction has its start time adjusted, the profile timestamp was incorrectly set to the app start time, while profile samples were relative to the JS VM start. This caused a visual offset in the Sentry profiling UI.
Relay does not validate the profile
timestampagainst the transactionstart_timestamp, so this change is safe from the ingestion side.💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps